//
//  AdvancedQueryViewController.m
//  Audit
//
//  Created by cc on 15-2-28.
//  Copyright (c) 2015年 cc. All rights reserved.
//

#import "AdvancedQueryViewController.h"
#import "Car.h"

@interface AdvancedQueryViewController ()

@end

@implementation AdvancedQueryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

-(IBAction)quickQueryAction:(id)sender
{
    //快速查询
    if ([self.delegate respondsToSelector:@selector(advancedQueryQuickQuery)]) {
        [self.delegate advancedQueryQuickQuery];
    }
}

-(IBAction)queryAction:(id)sender
{
    //查询
    if ([self.delegate respondsToSelector:@selector(beginQueryByCondition:)]) {
        Car *condition=[[Car alloc] init];
        
        condition.vin            = textFieldVIN.text;
        condition.model          = textFieldModel.text;
        condition.csn            = textFieldCsn.text;

        condition.plant          = textFieldPlant.text;
        condition.domain         = textFieldDomain.text;
        condition.auditGroup     = textFieldAuditGroup.text;
        condition.shiftDate      = textFieldShiftDate.text;
        condition.buildDate      = textFieldBuildDate.text;
        condition.series         = textFieldSeries.text;
        condition.phase          = textFieldPhase.text;
        condition.transmission   = textFieldTransmission.text;
        condition.color          = textFieldColor.text;
        condition.drivedirection = textFieldDriveDirection.text;
        condition.defect_info    = textFieldDefect_Info.text;
        condition.repair_info    = textFieldRepair_Info.text;
        
        [self.delegate beginQueryByCondition:condition];//传入查询条件
    }
}

@end
